Internally in gnome-shell it may be useful to modify the actions
available on a notification while it’s still visible, but without
clearing them all and re-creating them.
Allow that by returning the action object when adding it, and adding a
`removeAction()` method which takes that object and removes it.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3251>
});
this._actions.push(action);
this.emit('action-added', action);
+ return action;
+ }
+
+ removeAction(action) {
+ const index = this._actions.indexOf(action);
+ if (index < 0)
+ throw new Error('Action was already removed previously');
+
+ this._actions.splice(index, 1);
+ this.emit('action-removed', action);
}
clearActions() {